gl renderer: Add debug code to dump framebuffer
authorTimm Bäder <mail@baedert.org>
Sun, 31 Mar 2019 04:14:41 +0000 (06:14 +0200)
committerTimm Bäder <mail@baedert.org>
Sun, 31 Mar 2019 04:14:41 +0000 (06:14 +0200)
This way we can specify it on specific add_offscreen_ops callsites.

gsk/gl/gskglrenderer.c

index 599c7a760ca0c2ff63d6e294399422597987cd1d..44c43d0d4fe6d7d00b40d85647beb5e1a49d3552 100644 (file)
 
 typedef enum
 {
-  FORCE_OFFSCREEN = 1 << 0,
-  RESET_CLIP      = 1 << 1,
-  RESET_OPACITY   = 1 << 2
+  FORCE_OFFSCREEN  = 1 << 0,
+  RESET_CLIP       = 1 << 1,
+  RESET_OPACITY    = 1 << 2,
+  DUMP_FRAMEBUFFER = 1 << 3
 } OffscreenFlags;
 
 static void G_GNUC_UNUSED
@@ -2673,6 +2674,18 @@ add_offscreen_ops (GskGLRenderer         *self,
 
   gsk_gl_renderer_add_render_ops (self, child_node, builder);
 
+#ifdef G_ENABLE_DEBUG
+  if (G_UNLIKELY (flags & DUMP_FRAMEBUFFER))
+    {
+      static int k;
+      ops_dump_framebuffer (builder, g_strdup_printf ("%s_%p_%d.png",
+                                                      child_node->node_class->type_name,
+                                                      child_node,
+                                                      k ++),
+                            width, height);
+    }
+#endif
+
   if (flags & RESET_OPACITY)
     ops_set_opacity (builder, prev_opacity);